CvApi2
Overview
This is the root node for the Customer Visual API version 2.0. It is the entry point for accessing the custom visual API’s giving access to the query results, query meta structure, styling and additional utilities to render the custom visual.*
- From version: 2020.20
Properties
canvas
canvas: Canvas
The visual container. The Canvas is used for accessing properties and functions related to visualization and rendering.
const element = cvApi2.canvas.getHTMLElement();
enums
enums: Enums
Enumerations of standard values used in the API. Enums are used to make logical and structural distinctions between different parts of the API.
let columnDropzones = cvApi2.utils.getDropzone(cvApi2.enums.DropZoneType.Columns);
externalLibraries
externalLibraries: ExternalLibraries
The collection of external, third party libraries. Use this to include and then access third party libraries for drawing or building custom visuals.
function main() {
let d3 = cvApi2.externalLibraries.d3;
cvApi2.externalLibraries.addExternalLibraries(["https://cdn.plot.ly/plotly-latest.min.js"]);
this.onRender = render;
}
function render(){
Plotly.newPlot(divId, data, layout, config);
}
resultSet
resultSet: ResultSet
The query's data result set. The custom visual will make use of the data set to draw or display query results.
const currentTrellisedData = cvApi2.resultSet.data.getCurrentTrellisData();
utils
utils: Utils
API utility functions. Utilities for general operations to simplify methods or for items that are not accessible through API objects.
let columnDropzones = cvApi2.utils.getDropzone(cvApi2.enums.DropZoneType.Columns);
Methods
setConfig
setConfig ( config : VisualConfig ): void
This function will let you set the configuration for your Custom Visual. Change the configuration so the custom visual will fit best for your design.
cvApi2.setConfig({'waitForCompleteNotify': true})
Parameters
-
config:VisualConfig
The properties the visual need as a flag.
Returns void